package day2.LC242;

public class Main {
    public static void main(String[] args) {

    }
}


class Solution {
    public boolean isAnagram(String s, String t) {
        if (s.length() != t.length()) {
            return false;
        }
        int[] sArr = new int[26*2];
        int[] tArr = new int[26*2];
        for (int i = 0; i < s.length(); i++) {
            //比题目多考虑一个大小写
            if (Character.isUpperCase(s.charAt(i))) {
                sArr[s.charAt(i)-'A'+26]++;
            }else {
                sArr[s.charAt(i)-'a']++;
            }
        }
        for (int i = 0; i < t.length(); i++) {
            //比题目多考虑一个大小写
            if (Character.isUpperCase(t.charAt(i))) {
                tArr[t.charAt(i)-'A'+26]++;
            }else {
                tArr[t.charAt(i)-'a']++;
            }
        }
        boolean flag=true;
        for (int i = 0; i < 26 * 2; i++) {
            if (sArr[i] != tArr[i]) {
                flag=false;
                break;
            }
        }
        return flag;
    }
}